﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using SaludOcupacional.Controller;
using SaludOcupacional.DataAccess;
using SaludOcupacional.Model;

namespace SaludOcupacional
{
    /// <summary>
    /// Interaction logic for Window2.xaml
    /// </summary>
    public partial class Window2 : Window
    {
        public Window2()
        {
            InitializeComponent();
        }

        private void button2_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (LoginManager.LoginOn(xLogin.Text, xPassword.Password))
                {

                    Hide();
                    Menu menu = new Menu(xLogin.Text);
                    menu.Show();
                }
                else
                {
                    MessageBox.Show("Error " + "login o Password incorrecto");
                }
                
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error " + ex.Message);
            }
        }

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            Close();
        }

        private void xLogin_TextChanged(object sender, TextChangedEventArgs e)
        {

        }
    }
}
